import random
def randuser():
    with open("D:\\pythonProject\\day05\\user.txt","rb") as f:
        data = f.readlines()
    data1 = []
    for i in data :
        i = str(i,encoding="utf8")
        i = i.rstrip()
        data1.append(i)
    print(data1)
    while True:
        try:
            num = input("------您好，请选择：1-抽奖 2-退出------ \n")
            if num == "1" :
                luckuser = random.choice(data1)
                print("抽奖幸运观众")
                print(luckuser)
                data1.remove(luckuser)
                if data1 == [] :
                    print("抽奖完毕！")
                    break
            elif num == "2" :
                print("谢谢使用！")
                break
            else :
                print("只能输入1-2，请重新输入！")
        except KeyboardInterrupt :
            print("谢谢使用！")
            break
if __name__ == "__main__" :
    randuser()
